package com.write.spring.ioc.service;

import com.write.spring.ioc.annotation.Autowired;
import com.write.spring.ioc.annotation.Component;
import com.write.spring.ioc.annotation.Scope;
import com.write.spring.ioc.core.BeanNameWare;
import com.write.spring.ioc.util.ScopeEnum;

@Component("userService")
@Scope("singleton")
public class UserService implements BeanNameWare {

    @Autowired
    private OrderService orderService;
    private String beanName;

    public void test() {
        System.out.println(orderService);
        System.out.println(this.beanName);
    }

    @Override
    public void setBeanName(String beanName) {
        System.out.println("userService set beanName -> " + beanName);
        this.beanName = beanName;
    }
}
